home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 6 / Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso / 025a / gsdb25.zip / DB_XPL04.PAS < prev    next >
Pascal/Delphi Source File  |  1990-12-01  |  2KB  |  75 lines

  1. program DB_Xpl04;
  2. uses
  3.    CRT,
  4.    DOS,
  5.    GS_KeyI,
  6.    GS_dBFld,
  7.    GS_dBase;
  8.  
  9. var
  10.    Health  : GS_dBFld_Objt;
  11.    DumyStr : string;
  12.  
  13. procedure DisplayRecord;
  14. begin
  15.    Health.FieldDisplay('FOOD','Name of Food: ',1,1);
  16.    Health.FieldDisplay('QUANTITY','Quantity: ',1,2);
  17.    Health.FieldDisplay('UNITTYPE','Type of Unit: ',1,3);
  18.    Health.FieldDisplay('CALS','Calories: ',1,4);
  19.    Health.FieldDisplay('TOT_FAT_G','Total Fat: ',1,5);
  20.    Health.FieldDisplay('SAT_FAT_G','Saturated Fat: ',1,6);
  21.    Health.FieldDisplay('CHOLES_MG','Cholesterol per Mg: ',1,7);
  22.    Health.FieldDisplay('COMMENTS','Comments: ',1,8);
  23. end;
  24.  
  25. procedure ModifyRecord;
  26. var
  27.    dp,
  28.    da : string[2];
  29.  
  30.    procedure AcceptRec(FieldName, FieldTitle : string; x, y : integer);
  31.    begin
  32.       DumyStr := Health.FieldAccept(FieldName, FieldTitle, x, y);
  33.       if not GS_KeyI_Esc then
  34.          Health.FieldPut(FieldName,DumyStr);
  35.    end;
  36.  
  37. begin
  38.    AcceptRec('FOOD','Name of Food: ',1,1);
  39.    if not GS_KeyI_Esc then AcceptRec('QUANTITY','Quantity: ',1,2);
  40.    if not GS_KeyI_Esc then AcceptRec('UNITTYPE','Type of Unit: ',1,3);
  41.    if not GS_KeyI_Esc then AcceptRec('CALS','Calories: ',1,4);
  42.    if not GS_KeyI_Esc then AcceptRec('TOT_FAT_G','Total Fat: ',1,5);
  43.    if not GS_KeyI_Esc then AcceptRec('SAT_FAT_G','Saturated Fat: ',1,6);
  44.    if not GS_KeyI_Esc then AcceptRec('CHOLES_MG','Cholesterol per Mg: ',1,7);
  45.    if not GS_KeyI_Esc then AcceptRec('COMMENTS','Comments: ',1,8);
  46.    if GS_KeyI_Esc then exit;
  47.    GoToXY(1,10);
  48.    write('Delete Record?');
  49.    if Health.DelFlag then dp := 'Y' else dp := 'N';
  50.    da := Health.EditString(dp,16,10,1);
  51.    GoToXY(1,10);
  52.    write('':18);
  53.    if da <> dp then
  54.       if (da = 'Y') or (da = 'y') then Health.Delete else Health.UnDelete
  55.    else
  56.       Health.PutRec(Health.RecNumber);
  57. end;
  58.  
  59. begin
  60.    ClrScr;
  61.    GotoXY(1,16);
  62.    write('Press ESC to stop, any other key to continue');
  63.    Health.Init('HEALTH');
  64.    Health.Open;
  65.    Health.Index('FOODNAME');
  66.    Health.GetRec(Top_Record);
  67.    while (not Health.File_EOF) and (not GS_KeyI_Esc) do
  68.    begin
  69.       DisplayRecord;
  70.       ModifyRecord;
  71.       Health.GetRec(Next_Record);
  72.    end;
  73.    Health.Close;
  74. end.
  75.